package com.atguigu.sparkcore.day03.ser

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/**
 * Author atguigu
 * Date 2020/10/30 10:10
 */
object SerDemo1 {
    def main(args: Array[String]): Unit = {
        
        //1.创建SparkConf并设置App名称
        val conf: SparkConf = new SparkConf().setAppName("SparkCoreTest").setMaster("local[*]")
        
        //2.创建SparkContext，该对象是提交Spark App的入口
        val sc: SparkContext = new SparkContext(conf)
        
        //3.创建一个RDD
        val rdd: RDD[String] = sc.makeRDD(Array("hello world", "hello spark", "hive", "atguigu"), 2)
        val rdd2 = rdd.map(_ => new User)
        
        rdd2
            .foreach(println)
        //4.关闭连接
        sc.stop()
    }
}
class User()

